home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 5 / chrpro3.zip / CFBUDGDE.CMD < prev    next >
OS/2 REXX Batch file  |  1991-01-21  |  7KB  |  285 lines

  1. * Program CFBUDGDE - View/edit a particular church department budget
  2. Select secondary
  3. Use workshet
  4. Select primary
  5. If len(NSEL)>1
  6.   Store $(NSEL,2,1) to indept
  7. else
  8.   Accept 'Enter a Department Number ' to INDEPT
  9. endif
  10. Store T to inval2
  11. Do while inval2
  12.   If indept=' ' .or. !(INDEPT)='Q'
  13.     RETURN
  14.   endif
  15.   Store 'D'+$(INDEPT,1,1) to INDFIND
  16.   Find &INDFIND
  17.   If # = 0
  18.     Accept 'Department number not found. Enter again ' to INDEPT
  19.   else
  20.     Store F to inval2
  21.   endif
  22. ENDDO
  23. Release NSEL,INVAL1,indept
  24. Store $(account,4,30) to deptname
  25. ?
  26. ? 'Now reading the Account entries for Department:',deptname
  27. Store # to INDX
  28. Store ' ' to OSEL
  29. Store '0' to N
  30. Do while !(OSEL)<>'Q'
  31. Select primary
  32. Find &INDFIND
  33. SKIP
  34. Store 'A' to OSEL
  35. Store 64 to I
  36. Store 0.00 to acctytd
  37. Store 0.00 to accntpo
  38. Store 0.00 to accntbal
  39. Store 0.00 to no
  40. Store 0.00 to tp
  41. Do while .not. EOF .and. account=INDFIND .and. I<79
  42.   Store I+1 to I
  43.   Store chr(I) to N
  44.   Store val(paidytd)+acctytd to acctytd
  45.   Store $(account,3,29)+paidytd+' '+str(prevowed,9,2) to accname&N
  46.   Store prevowed+accntpo to accntpo
  47.   Replace NO&N with newowed
  48.   Store newowed+no to no
  49.   Replace TP&N with newpaid
  50.   Store newpaid+tp to tp
  51.   Store pp to PP&N
  52.   SKIP
  53. enddo
  54. Set colon off
  55. SKIP -1
  56. Store $(account,3,1) to NN
  57. If I=64
  58.   Store '@' to NN
  59. endif
  60. Store I to II
  61. Do while !(OSEL)='R'.or.!(OSEL)='O'.or.!(OSEL)='P'.or.!(OSEL)='A'
  62. ERASE
  63. @ 0,1 say MFILE
  64. @ 0,62 say curdate
  65. @ 1,4 say CHNAME+' Monthly Budget for : '+deptname
  66. If !(OSEL)='O'
  67.   @ 2,51 say '*******'
  68. endif
  69. If !(OSEL)='P'
  70.   @ 2,61 say '******* *'
  71. endif
  72. @ 3,9  say 'Account           year-to-date  previous     new      to be '
  73. @ 3,74 say 'owed'
  74. @ 4,18 say '              actual     owed      owed       paid     balance'
  75. Store 64 to I
  76. If II=64
  77.   @ 5,25 say '**** NO ACCOUNTS IN THIS DEPARTMENT ****'
  78. else
  79.  Store 0.00 to accntbal
  80.  Do while I < II
  81.   Store I+1 to I
  82.   Store chr(I) to N
  83.   @ I-59,0 say accname&N
  84.   Store val($(accname&N,39,9))+NO&N-TP&N to BAL
  85.   @ I-59,69 say PP&N
  86.   If !(OSEL)='O'
  87.     @ I-59,50 get NO&N
  88.   else
  89.     @ I-59,50 say NO&N
  90.   endif
  91.   If !(OSEL)='P' .and. PP&N<>'*'
  92.     @ I-59,60 get TP&N
  93.     @ I-59,69 get PP&N
  94.   else
  95.     @ I-59,60 say TP&N
  96.     @ I-59,69 say PP&N
  97.   endif
  98.   @ I-59,70 say BAL
  99.   Store accntbal+BAL to accntbal
  100.  enddo
  101. endif
  102. @ I-58,23 say '^      --------   -------   -------   -------     -------'
  103. READ
  104. GOTO 1
  105. If OSEL<>' '
  106.   Store 64  to J
  107.   Store 0.00 to TP
  108.   Store 0.00 to NO
  109.   Store 0.00 to accntbal
  110.   Do while J < II .and. !(OSEL)<>' '
  111.     Store J+1 to J
  112.     Store chr(J) to N
  113.     Store tp+tp&N to TP
  114.     Store NO+NO&N to NO
  115.     Store val($(accname&N,39,8))+NO&N-TP&N to BAL
  116.     @ J-59,70 say BAL
  117.     Store accntbal+bal to accntbal
  118.   enddo
  119.  endif
  120.  @ I-57,28 say acctytd
  121.  @ I-57,38 say accntpo
  122.  @ I-57,48 say no
  123.  @ I-57,58 say tp
  124.  @ I-57,70 say accntbal
  125.  ?      'Select  [O]wed editing    [A]dd a new account        [R]eport'
  126.  Accept '        [P]aid editing    [D]elete existing account  [Q]uit  ' to OSEL
  127.  Store T to inval2
  128.  Do while inval2
  129.   Store F to inval2
  130.   Do case
  131.   CASE !(OSEL)='O'
  132.     Store F to inval2
  133.   CASE !(OSEL)='P'
  134.     Store F to inval2
  135.   CASE !(OSEL)='A'
  136.     Store 'Y' to XX
  137.     Do while !(XX)='Y'
  138.       * ACCOUNT lettering can range from "A" to "Y"
  139.       * Deleted account letters are not-re-used.
  140.       If II=79 .or. NN='Y'
  141.  ? 'Illegal ADD - 15 accounts allowed, maximum. Highest account letter = "Y".'
  142.         Store ' ' to XX
  143.       else
  144.       Release BAL,OSEL
  145.       Store II+1 to I
  146.       Store I to II
  147.       Store chr(I) to N
  148.       Clear gets
  149.       Set colon on
  150.       Store 0.00 to TP
  151.       Store 0.00 to NO
  152.       Store '                        '  to XX
  153.       Store '                         ' to AD1
  154.       Store '                         ' to AD2
  155.       If I<76
  156.         @ I-53,0 say 'ACCOUNT name' get XX
  157.         @ I-53,43 say 'payment' get TP
  158.         @ I-53,64 say 'owed' get NO
  159.         @ I-52,0 say 'ADDRESS' get AD1
  160.         @ I-52,32 say '  ^  CITY,STATE ZIP' get AD2
  161.       else
  162.         @ 22,0 say 'ACCOUNT name' get XX
  163.         @ 22,43 say 'payment' get TP
  164.         @ 22,64 say 'owed' get NO
  165.         @ 23,0 say 'ADDRESS' get AD1
  166.         @ 23,32 say '  ^  CITY,STATE ZIP' get AD2
  167.       endif
  168.       READ
  169.       Store len(trim(XX)) to J
  170.       Set colon off
  171.       Select primary
  172.       If XX<>'    '
  173.       Append blank
  174.       Store chr(rank(NN)+1) to NN
  175.       Replace account with indfind+NN+' '+XX
  176.       If TP<>0.00
  177.         Store 'P' to PP&N
  178.       else
  179.         Store ' ' to PP&N
  180.       endif
  181.       Replace newpaid with 0.00
  182.       Replace newowed with 0.00
  183.       Replace paidytd with '     0.00'
  184.       Store $(account,3,29)+paidytd+' '+str(prevowed,8,2) to accname&N
  185.       Select secondary
  186.       Replace TP&N with tp
  187.       Replace NO&N with NO
  188.       else
  189.        ? 'No account name entered. No account was added.'
  190.        Store II-1 to II
  191.       endif
  192.       Accept 'Add another ACCOUNT? ' to XX
  193.       Release AD1,AD2
  194.      endif
  195.     ENDDO
  196.     Store 'A' to OSEL
  197.   CASE !(OSEL)='D'
  198.     Select primary
  199.     Store 'Y' to N
  200.     ? 'WARNING: This routine causes any amount updates to be forgotten.'
  201.     Do while !(N)='Y'
  202.     Accept 'Enter account to be deleted ' to N
  203.     Store INDFIND+N  to XX
  204.     Find &XX
  205.     If #=0
  206.       ? 'This account letter is not found.'
  207.     else
  208.      If val(paidytd)= 0 .and. (PP<>'*' .or. newpaid=0)
  209.       ? account,'has been deleted.'
  210.       Replace account with 'E'+$(account,2,33)
  211.       Release accname&N,PP&N
  212.      else
  213.       ? 'This account has previous amounts paid. It is not valid to delete it.'
  214.      endif
  215.     endif
  216.     Accept 'Delete another? ' to N
  217.     enddo
  218.     Select secondary
  219.   CASE !(OSEL)='R'
  220.     Set format to print
  221. @ 1,3 say MFILE
  222. @ 1,60 say curdate
  223. @ 2,8  say CHNAME+' Monthly Budget - for : '+deptname
  224. @ 4,9  say 'Account                 paid    previous     new      to be '
  225. @ 5,18 say '             this yr     owed       owed      paid    Balance'
  226. Store 64 to I
  227. Do while I<>II
  228.   STORE I+1 TO I
  229.   Store CHR(I) to N
  230.   @ I-58,0 say accname&N
  231.   Store val($(accname&N,39,8))+NO&N-TP&N to BAL
  232.   @ I-58,50 say NO&N
  233.   @ I-58,60 say TP&N
  234.   @ I-58,69 say PP&N
  235.   @ I-58,71 say str(BAL,8,2)
  236. enddo
  237. @ I-57,30 say '--------   -------   -------   -------    -------'
  238. @ I-56,28 say acctytd
  239. @ I-56,38 say accntpo
  240. @ I-56,48 say no
  241. @ I-56,58 say tp
  242. @ I-56,69 say accntbal
  243.     EJECT
  244.     Set format to screen
  245.   CASE !(OSEL)='Q'
  246.     Release NN,bal,accntbal,acctytd
  247.     Store F to inval2
  248.     Store 64  to I
  249.     Select primary
  250.     GOTO INDX
  251.     SKIP
  252.     Store 0.00 to NN
  253.     Store 0.00 to NO
  254.     Do while I<II
  255.      Store I+1 to I
  256.      Store chr(I) to N
  257.      Replace newowed with S.NO&N
  258.      Replace newpaid with S.TP&N
  259.      If PP&N='*'.and.PP<>'*'
  260.        Store ' ' to PP&N
  261.      endif
  262.      If PP&N='*'
  263.        Store NO+newpaid to NO
  264.      else
  265.        Store NN+newpaid to NN
  266.        Replace pp with PP&N
  267.      endif
  268.      Release PP&N,accname&N
  269.      SKIP
  270.     enddo
  271.     GOTO INDX
  272.     Replace newpaid with NN
  273.     Replace newowed with NO
  274.     Release inval2,no,accntpo,tp,INDFIND,J,I,N,II,NN,deptname,XX,osel,indx
  275.     Store 'D' to nsel
  276.     RETURN
  277.   otherwise
  278.     Store T to inval2
  279.     Accept 'Invalid entry. Please enter again ' to OSEL
  280.   ENDCASE
  281. ENDDO
  282. ENDDO
  283. ENDDO
  284. RETURN
  285.